package com.xzzz.irda.guardcat.core.metric.druid;

import java.util.Date;

/**
 * druid 连接池信息
 *
 * @author xzzz
 * @since 1.0.0
 */
public class DruidConnectionPoolInfo {
    /**
     * 连接池名字
     */
    private String name;
    /**
     * 数据源创建时间
     */
    private Date createdTime;
    /**
     * 数据库的访问地址
     */
    private String url;
    /**
     * 数据库的用户名
     */
    private String username;
    /**
     * 所用 druid 的版本
     */
    private String version;
    /**
     * 连接池中最小空闲连接数
     */
    private Integer minIdle;
    /**
     * 连接池中最大空闲连接数
     */
    private Integer maxIdle;
    /**
     * 连接池中最大连接数
     */
    private Integer maxActive;
    /**
     * 当前连接池中活跃连接数
     *      连接池满了条件：
     *          poolingCount + activeCount >= maxActive
     */
    private Integer activeCount;
    /**
     * 当前连接池中空闲可用的连接数
     *      连接池满了条件：
     *          poolingCount + activeCount >= maxActive
     */
    private Integer poolingCount;
    /**
     * 连接池没有可用连接时，获取连接的最大等待时间(创建连接的时间 / 其他线程释放连接的时间)
     */
    private Long maxWait;
    /**
     * 当前等待获取可用连接时阻塞的业务线程的总个数。
     *      waitThreadCount 底层调用的就是 notEmptyWaitThreadCount
     */
    private Integer waitThreadCount;
    /**
     * 等待获取连接的最大线程数
     */
    private Integer maxWaitThreadCount;
    /**
     * 重置统计的次数
     */
    private Long resetCount;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(Date createdTime) {
        this.createdTime = createdTime;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public Integer getMinIdle() {
        return minIdle;
    }

    public void setMinIdle(Integer minIdle) {
        this.minIdle = minIdle;
    }

    public Integer getMaxIdle() {
        return maxIdle;
    }

    public void setMaxIdle(Integer maxIdle) {
        this.maxIdle = maxIdle;
    }

    public Integer getMaxActive() {
        return maxActive;
    }

    public void setMaxActive(Integer maxActive) {
        this.maxActive = maxActive;
    }

    public Integer getActiveCount() {
        return activeCount;
    }

    public void setActiveCount(Integer activeCount) {
        this.activeCount = activeCount;
    }

    public Integer getPoolingCount() {
        return poolingCount;
    }

    public void setPoolingCount(Integer poolingCount) {
        this.poolingCount = poolingCount;
    }

    public Long getMaxWait() {
        return maxWait;
    }

    public void setMaxWait(Long maxWait) {
        this.maxWait = maxWait;
    }

    public Integer getWaitThreadCount() {
        return waitThreadCount;
    }

    public void setWaitThreadCount(Integer waitThreadCount) {
        this.waitThreadCount = waitThreadCount;
    }

    public Integer getMaxWaitThreadCount() {
        return maxWaitThreadCount;
    }

    public void setMaxWaitThreadCount(Integer maxWaitThreadCount) {
        this.maxWaitThreadCount = maxWaitThreadCount;
    }

    public Long getResetCount() {
        return resetCount;
    }

    public void setResetCount(Long resetCount) {
        this.resetCount = resetCount;
    }

    @Override
    public String toString() {
        return "DruidConnectionPoolInfo{" +
                "name='" + name + '\'' +
                ", createdTime=" + createdTime +
                ", url='" + url + '\'' +
                ", username='" + username + '\'' +
                ", version='" + version + '\'' +
                ", minIdle=" + minIdle +
                ", maxIdle=" + maxIdle +
                ", maxActive=" + maxActive +
                ", activeCount=" + activeCount +
                ", poolingCount=" + poolingCount +
                ", maxWait=" + maxWait +
                ", waitThreadCount=" + waitThreadCount +
                ", maxWaitThreadCount=" + maxWaitThreadCount +
                ", resetCount=" + resetCount +
                '}';
    }
}
